require 'erb'
require 'components/CFM/base'

class VlanTag

  attr_accessor :message

  def initialize(base, vlan_identifier=0)
    @base = base
    @vlan_identifier = vlan_identifier

    template = '
          vlan_tag_<%= @base.step %> = struct [
              # TPID|Tag Protocol ID
              0h8100
              # PCP|Priority Code Point (0 to 7)
              0:3
              # CFI|Canonical Format Identifier, 0=ethernet
              0:1
              # VID|V-LAN Identifer (1-4094)
              <%= vlan_identifier %>:12
           ]'

    erb = ERB.new(template, 0, '%<>')
    @message = erb.result(binding)

  end

end

=begin

=end